/*
 * @Author: xym100111100 253274870@qq.com
 * @Date: 2024-03-19 10:23:53
 * @LastEditors: xym100111100 253274870@qq.com
 * @LastEditTime: 2024-08-09 11:22:44
 * @FilePath: \RuoYi-Vue3\src\api\system\dict\data.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'


export type DictObj = {
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
  remark?: string;
  dictCode: string;
  dictSort?: number;
  dictLabel: string;
  dictValue: string;
  dictType: string;
  cssClass?: string;
  listClass?: string;
  isDefault?: string;
  elTagType?: string;
  elTagClass?: string;
  status?: string;
  default?: boolean;
  label?: string;
  value?: string;
};

// 查询字典数据列表
export function listData(query:DictObj) {
  return request({
    url: '/system/dict/data/list',
    method: 'get',
    params: query
  })
}

// 查询字典数据详细
export function getData(dictCode:string) {
  return request({
    url: '/system/dict/data/' + dictCode,
    method: 'get'
  })
}

// 根据字典类型查询字典数据信息
export function getDicts(dictType:string) {
  return request({
    url: '/system/dict/data/type/' + dictType,
    method: 'get'
  })
}


// 新增字典数据
export function addData(data:DictObj) {
  return request({
    url: '/system/dict/data',
    method: 'post',
    data: data
  })
}

// 修改字典数据
export function updateData(data:DictObj) {
  return request({
    url: '/system/dict/data',
    method: 'put',
    data: data
  })
}

// 删除字典数据
export function delData(dictCode:string) {
  return request({
    url: '/system/dict/data/' + dictCode,
    method: 'delete'
  })
}
